package org.example.study.sc.controller;

import org.example.common.result.R;
import org.example.study.sc.entity.OrderMaster;
import org.example.study.sc.service.OrderMasterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.math.BigDecimal;

/**
 * @program: rabbitmq-study
 * @description:
 * @Version V1.0.0
 * @author: dazhi
 * @create: 2021-02-03 16:57
 **/
public class PayController {

    @Autowired
    OrderMasterService orderMasterService;

    @GetMapping(value = "/pay/{orderId}/{money}")
    public R<String> pay(@PathVariable("orderId") Long orderId, @PathVariable("money") BigDecimal money) {
        //初始化库存数量
        OrderMaster orderMaster = orderMasterService.getById(orderId);
        orderMaster.setStatus(1);
        orderMasterService.updateById(orderMaster);
        return R.data("付款成功，等待发货！");
    }

}
